﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Configuration;
using System.Web.Mvc;
using ZBJF.Warranty.BLL;
using ZBJF.Warranty.Common.Common;
using ZBJF.Warranty.Common.Enums;
using ZBJF.Warranty.Model;
using ZBJF.Warranty.Model.ViewModel.CommonObject;
using ZBJF.Warranty.WebProvider.Filter;

namespace ZBJF.Warranty.WebProvider
{
    public class BaseController : Controller
    {
        private SystemUser _currentUser;
        public SystemUser CurrentUser
        {
            get
            {
                 _currentUser = WebContext.Instance.CurrentUser;
                    return _currentUser;
            }
            set
            {
                WebContext.Instance.CurrentUser = value;
                _currentUser = value;
            }
        }
        /// <summary>
        /// 未读消息的数量
        /// </summary>
        public int MessageCount { get; set; }

        [LoginFilter(IsCheck = false)]
        public ActionResult Redirect(RedirectType redirectType, string msg, string redirectUrl = null)
        {
            var info = new RedirectInfo { Msg = msg, RedirectType = redirectType, RedirectUrl = redirectUrl };
            TempData["RedirectInfo"] = info;
            return RedirectToAction("Redirect", "Common");
        }
        [LoginFilter(IsCheck = false)]
        public ActionResult Redirect(RedirectInfo info)
        {
            TempData["RedirectInfo"] = info;
            return RedirectToAction("Redirect", "Common");
        }
    }
}
